home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1988 July & August / rerun-1988-07-08.d64 / travel tally (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  7KB  |  223 lines

  1. 10 rem business trip by kenny lawson
  2. 20 forx=1to10:reada$:cn$(x)=a$:next
  3. 30 forx=828to935:reada:pokex,a:next
  4. 40 w1$="                             ":w2$=w1$+"[144] "
  5. 50 w3$="[144]"+right$(w1$,30):mm$="   "+chr$(18)+chr$(129)+mid$(w1$,3,18)+"[146]   "
  6. 60 w4$="[156]                     ":w5$=w4$+"[144] ":dy=0:fi$="expense.sq"
  7. 70 w6$=left$(w3$,23):ch$="chooseanoption":sv=0:dimz$(23)
  8. 80 forx=1to10:forc=1to16-len(cn$(x)):cn$(x)=cn$(x)+chr$(32):nextc
  9. 90 cn$(x)=chr$(32)+cn$(x):nextx:dl$="[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
  10. 100 l1$="[175][175][146]":l2$="[185][185][146]":l3$="[162][162][146]":l4$="[184][184][146]":l5$="[183][183][146]"
  11. 110 bc$="  [146][145][157][157]":ta$="                     "
  12. 120 ta(1)=9:forx=2to10:ta(x)=ta(x-1)+3:next
  13. 130 co$(1)="":co$(2)="[156]":co$(3)="":co$(4)="":co$(5)="[154]"
  14. 140 co$(6)="[129]":co$(7)="[149]":co$(8)="[153]":co$(9)="[150]":co$(10)="[151]"
  15. 150 open15,8,15:open8,8,8,fi$+",s,r":input#15,er$:bb$="0":ed=0
  16. 160 ifval(er$)<19thenclose8:close15:goto190
  17. 170 print#15,"uj":forx=1to2000:next:close15
  18. 180 close8:open8,8,8,fi$+",s,w":forx=1to10:print#8,bb$:next:close8:close15
  19. 190 printchr$(30)chr$(147):poke53280,15:poke53281,15
  20. 200 print"[129][207][180]"tab(37)"[170][208]"
  21. 210 print"[208][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][207]"
  22. 220 forx=1to20:print"[167]"tab(38)"[180]":next
  23. 230 print"[186][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][204]"
  24. 240 print"[204][180]"tab(37)"[170][186]";
  25. 250 printchr$(19):print:print:print"[129]business diary and expense chart"
  26. 260 printtab(8)mm$:printtab(8)"       main  menu    [146]   "
  27. 270 forx=1to2:printtab(8)mm$:next:printtab(8)"    1. load the file [146]   "
  28. 280 printtab(8)"    2. save the file [146]   "
  29. 290 printtab(8)"    3. enter amounts [146]   "
  30. 300 printtab(8)"    4. see bar chart [146]   "
  31. 310 printtab(8)"    5. check totals  [146]   "
  32. 320 printtab(8)"    6. exit program  [146]   "
  33. 330 forx=1to4:printtab(8)mm$:next:print"[145][145][145]"
  34. 340 printtab(11)ch$:geta$
  35. 350 ifa$<>""then370
  36. 360 forx=1to300:next:print"[145][145]":printtab(8)mm$"[145]":forx=1to300:next:goto340
  37. 370 a=val(a$):ifa<1ora>6then360
  38. 380 onagoto690,790,400,1100,1560,1670
  39. 390 rem get category inputs
  40. 400 poke53280,14:poke53281,14:printchr$(159)chr$(147)chr$(17)
  41. 410 a$=chr$(18)+chr$(32):printtab(11);:forx=1to19:printa$;:next:print
  42. 420 forx=1to21:printtab(11)a$spc(17)a$:next
  43. 430 printtab(11);:forx=1to19:printa$;:next:printchr$(19):forx=1to3:print:next
  44. 440 forx=1to10:printtab(12)cn$(x)chr$(17):next
  45. 450 print"":printtab(12)chr$(18)cn$(1)
  46. 460 print""tab(32)"use the"
  47. 470 print" business"tab(32)"cursor":print"  diary"tab(32)"keys to"
  48. 480 print"   and"tab(32)"move":print" expense":printtab(32)"return"
  49. 490 print"  chart":printtab(34)"to":printtab(32)"select"
  50. 500 printtab(32)"<m> for":printtab(33)"menu":poke214,3:print
  51. 510 geta$:ifa$=""then510
  52. 520 ifa$="m"then190
  53. 530 ifa$<>chr$(17)then590
  54. 540 gosub870:ifcn=10then570
  55. 550 print:printchr$(145)tab(12)cn$(cn)chr$(17)
  56. 560 printtab(12)chr$(18)cn$(cn+1);:goto510
  57. 570 print:printchr$(145)tab(12)cn$(cn):poke214,3:print:printtab(12)""cn$(1);
  58. 580 goto510
  59. 590 ifa$<>chr$(145)then650
  60. 600 gosub870:ifcn=1then630
  61. 610 print:printchr$(145)tab(12)cn$(cn):poke214,sn-3:print
  62. 620 printtab(12)chr$(18)cn$(cn-1);:goto510
  63. 630 print:printchr$(145)tab(12)cn$(1):poke214,21:print
  64. 640 printtab(12)chr$(18)cn$(10);:goto510
  65. 650 ifa$<>chr$(13)then510
  66. 660 gosub870:ro=peek(214):sys828:rem save screen
  67. 670 gosub980:rem input routine
  68. 680 goto510
  69. 690 rem load file
  70. 700 gosub770:rem draw window
  71. 710 printtab(9)"[156][145]loading"fi$:gosub1410:rem read disk status
  72. 720 close8:open8,8,8,"expense.sq,s,r"
  73. 730 forx=1to10:input#8,cs$(x):cn(x)=val(cs$(x)):next:close8
  74. 740 forx=1to10:ifcn(x)<>0thendy=1
  75. 750 next
  76. 760 gosub1410:goto250
  77. 770 print"":printtab(9)w4$:forx=1to3:printtab(9)w5$:next
  78. 780 printtab(10)w6$"[145][145][145][145]":return
  79. 790 rem save file
  80. 800 open15,8,15,"s0:bus.seq.del"
  81. 810 gosub770:printtab(10)"[156][145]saving"fi$
  82. 820 gosub1410:open15,8,15,"r0:bus.seq.del="+fi$
  83. 830 gosub1410:open15,8,15,"s0:"+fi$
  84. 840 gosub1410:close8:open8,8,8,fi$+",s,w"
  85. 850 forx=1to10:cs$(x)=str$(cn(x)):print#8,cs$(x):next
  86. 860 gosub1410:sv=1:goto250
  87. 870 rem check peek
  88. 880 sn=peek(214):ifsn=4thencn=1:return
  89. 890 ifsn=6thencn=2:return
  90. 900 ifsn=8thencn=3:return
  91. 910 ifsn=10thencn=4:return
  92. 920 ifsn=12thencn=5:return
  93. 930 ifsn=14thencn=6:return
  94. 940 ifsn=16thencn=7:return
  95. 950 ifsn=18thencn=8:return
  96. 960 ifsn=20thencn=9:return
  97. 970 cn=10:return
  98. 980 rem input routine
  99. 990 gosub1470:tp$="":printchr$(31);
  100. 1000 poke204,0:getd$:ifd$=""then1000
  101. 1010 ifd$="."then1050
  102. 1020 ifd$=chr$(13)then1050
  103. 1030 ifd$>"/"andd$<":"then1050
  104. 1040 wait207,1:poke204,1:gosub1790:gosub1510:goto990
  105. 1050 ifd$<>chr$(13)thentp$=tp$+d$:printd$;:goto1000
  106. 1060 wait207,1:poke204,1
  107. 1070 cn(cn)=cn(cn)+val(tp$):printchr$(159):ifcn(cn)<>0thendy=1
  108. 1080 sys882:poke214,ro-1:print:iftp$<>""thened=1
  109. 1090 return
  110. 1100 rem draw bar chart
  111. 1110 ifdythen1140
  112. 1120 gosub1790:gosub770:printtab(9)"[156]no data in categories"
  113. 1130 forx=1to2000:next:goto250
  114. 1140 poke53280,0:poke53281,0:printchr$(30)chr$(147);
  115. 1150 hi=0:forx=1to10:ifcn(x)>hithenhi=int(cn(x))
  116. 1160 next
  117. 1170 ifhi/20<>int(hi/20)thenhi=hi+1:goto1170
  118. 1180 in=int(hi/20):sa=hi-in
  119. 1190 forx=sato0step-in:print"$ "x;tab(8)dl$:next
  120. 1200 printtab(9)"d  e  h  m  p  s  t  g  t  v"
  121. 1210 print"category i  n  t  s  h  u  a  r  r  m"
  122. 1220 printtab(9)"n  t  l  c  o  p  x  a  a  t"
  123. 1230 print"         working....please wait        "
  124. 1240 pn=in/6:forx=1to10:ch(x)=int(cn(x)/in):cl(x)=cn(x)-ch(x)*in
  125. 1250 ifcl(x)=0thenpb$(x)="":goto1320
  126. 1260 ifcl(x)=<pnthenpb$(x)=l1$:goto1320
  127. 1270 ifcl(x)=<pn*2thenpb$(x)=l2$:goto1320
  128. 1280 ifcl(x)=<pn*3thenpb$(x)=l3$:goto1320
  129. 1290 ifcl(x)=<pn*4thenpb$(x)=l4$:goto1320
  130. 1300 ifcl(x)=<pn*5thenpb$(x)=l5$:goto1320
  131. 1310 ch(x)=ch(x)+1
  132. 1320 next
  133. 1330 forx=1to10:lt=0:poke214,18:print:printtab(ta(x));
  134. 1340 ifch(x)=0then1360
  135. 1350 forct=1toch(x):printco$(x)bc$;:next
  136. 1360 printco$(x)pb$(x):next
  137. 1370 poke214,23:print:print"    would you like a printout? (y/n)   "
  138. 1380 geta$:ifa$="y"then1850
  139. 1390 ifa$<>"n"then1380
  140. 1400 goto190
  141. 1410 rem check disk status
  142. 1420 close15:open15,8,15:input#15,v$,w$,x$,y$
  143. 1430 ifval(v$)<19thenclose15:return
  144. 1440 gosub1790
  145. 1450 printtab(10)"[156]diskerror:":printtab(10)""w$:forx=1to2000:next
  146. 1460 print#15,"uj":forx=1to1000:next:close15:goto250
  147. 1470 rem draw window 1
  148. 1480 print"":printtab(5)w1$:forx=1to6:printtab(5)w2$:next
  149. 1490 printtab(6)w3$"[145][145][145][145][145][145][145]":printtab(6)"entertoday'stotalamount"
  150. 1500 printtab(6)"for"cn$(cn):printchr$(17)tab(8)"$";:return
  151. 1510 rem draw window 2
  152. 1520 print"":printtab(9)w4$:forx=1to3:printtab(9)w5$:next
  153. 1530 printtab(10)w6$"[145][145][145][145][145][156]":printtab(10)"useonlynumbersor"
  154. 1540 printtab(11)"decimalpoint(.)"
  155. 1550 printtab(10)"re-entertheamount":forx=1to2500:next:return
  156. 1560 rem display totals
  157. 1570 poke53281,5:poke53280,5:poke646,13:printchr$(147):gt=0
  158. 1580 forx=1to10:printtab(5)cn$(x)tab(25)"$";:gosub1630:gt=gt+cn(x)
  159. 1590 printspc(9-le)le$:print:next
  160. 1600 print"total expenses= $";:le$=str$(gt):le=len(le$):gosub1640
  161. 1610 printle$tab(26)"press any key[146]";:poke198,0
  162. 1620 wait198,1:poke198,0:goto190
  163. 1630 le$=str$(cn(x)):le=len(le$)
  164. 1640 ifmid$(le$,le-1,1)="."thenle$=le$+"0":le=le+1
  165. 1650 ifval(le$)=int(val(le$))thenle$=le$+".00":le=le+3
  166. 1660 return
  167. 1670 rem exit program
  168. 1680 gosub1790:gosub770:printtab(10)"[156]quit? are you sure?"
  169. 1690 printtab(17)"(y/n)":poke198,0
  170. 1700 geta$:ifa$="n"then250
  171. 1710 ifa$<>"y"then1700
  172. 1720 ifsv=1ored=0then1770
  173. 1730 gosub1790:gosub770:printtab(11)"[156]changes not saved":poke198,0
  174. 1740 printtab(11)"still quit? (y/n)"
  175. 1750 geta$:ifa$="n"then250
  176. 1760 ifa$<>"y"then1750
  177. 1770 poke53280,14:poke53281,6:poke646,14:printchr$(